﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetCore.CAP;
//using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace WebApiForHealthCheck.Controllers
{
    [Route("[controller]")]
    
    public class DemoController : Controller
    {
        // GET: api/<controller>
        [HttpPost]
        [CapSubscribe("EIP.Message.Send.Sms")]
        public IEnumerable<string> Get(string data)
        {
            Console.WriteLine("我get啦{0}",data);
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
            var clienIds = new List<string>();
            clienIds.Add("fb71ea4503d919851527b96a2f8d72c7");
            clienIds.Add("8e171d9b5c75d60ded7844bcac16c05c");
            clienIds.Add("2333ebfaa0bee49dae26a6c9a033e348");

            //8e171d9b5c75d60ded7844bcac16c05c
            var messageBody = new MessageBodyExtra() {
                msg = "关于进一步细化的通知",
                title = "通知公告",
                path = "/pages/news/news",
                param = new Dictionary<string, string>() {
                    { "id","562356"}
                },
                type = AppMessageTypeEnum.公告,
                ab = "/pages/news/news",
            };
            return PushAPPMsgManger.PushMessageToList(clienIds,messageBody);
        }

        // POST api/<controller>
        [HttpPost]
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
